// pages/custom-tab-bar/index.js
Component({
  /**
   * 组件的属性列表
   */
  properties: {

  },

  /**
   * 组件的初始数据
   */
  data: {
    selected: 0,
    color: "#7A7E83",
    selectedColor: "#3cc51f",
    list: [{
      pagePath: "/pages/home/home",
      iconPath: "/assets/tabBar/home.png",
      selectedIconPath: "/assets/tabBar/home_hover.png", 
      text: "首页"
    }, {
      pagePath: "/pages/fence/fence", 
      iconPath: "/assets/tabBar/location.png",
      selectedIconPath: "/assets/tabBar/location_hover.png", 
      text: "围栏"
    }, {
      pagePath: "/pages/doList/doList", 
      iconPath: "/assets/tabBar/dolist.png",
      selectedIconPath: "/assets/tabBar/dolist_hover.png", 
      text: "待办"
    }, {
      pagePath: "/pages/news/news", 
      iconPath: "/assets/tabBar/news.png",
      selectedIconPath: "/assets/tabBar/news_hover.png", 
      text: "消息"
    }, {
      pagePath: "/pages/my/my",
      iconPath: "/assets/tabBar/me.png",
      selectedIconPath: "/assets/tabBar/me_hover.png", 
      text: "我的"
    },]
  },

  /**
   * 组件的方法列表
   */
  methods: {
    switchTab(e) {
      const data = e.currentTarget.dataset
      const url = data.path
      console.log(data)
      wx.switchTab({url})
      this.setData({
        selected: data.index
      })
    }
  }
})
